價格:免費
更新日期:2017-11-05
檔案大小:8.0M
目前版本:1.2
版本需求:Android 1.6 以上版本
官方網站:mailto:ngurahks@gmail.com
This is an (updated) app to control home appliances by using 4 channels relay and control it via bluetooth on your smartphone. Include On and Off status. Just plug your Arduino board device and control it easily with this Android application. This app has been tested many times, it's work well. Will work from Android 4.0.4 and above.
Improper hardware/software setup/installation is not my responsibility ! Always check your device connection before running it.
Instructions:
- Upload these codes to your Arduino board then install this application. The codes are described below:
//Koneksi relay 1, 2, 3 & 4 ke PIN 2,3,4 & 5 board Arduino Uno
//Connect your relay line 1, 2, 3 & 4 to PIN 2,3,4 & 5 Arduino's board
const int Relay1 = 2; //PIN 7 FOR RELAY #1
const int Relay2 = 3; //PIN 6 FOR RELAY #2
const int Relay3 = 4; //PIN 5 FOR RELAY #3
const int Relay4 = 5; //PIN 4 FOR RELAY #4
byte serialA;
void setup(){
Serial.begin(9600);
pinMode(Relay1,OUTPUT); //SETTING THE OUTPUT FOR RELAY #1
pinMode(Relay2,OUTPUT); //SETTING THE OUTPUT FOR RELAY #2
pinMode(Relay3,OUTPUT); //SETTING THE OUTPUT FOR RELAY #3
pinMode(Relay4,OUTPUT); //SETTING THE OUTPUT FOR RELAY #4
}
void loop() {
if (Serial.available()>0) {serialA =Serial.read(); Serial.println(serialA);}
switch(serialA){
case 49:
digitalWrite(Relay1, !digitalRead(Relay1));
delay(100);
break;
//if recieving a 49(ascii for 1) turn on Relay #1
case 50:
digitalWrite(Relay2, !digitalRead(Relay2));
delay(100);
break;
//if recieving a 50(ascii for 2) turn on Relay #2
case 51:
digitalWrite(Relay3, !digitalRead(Relay3));
delay(100);
break;
//if recieving a 51(ascii for 3) turn on Relay #3
case 52:
digitalWrite(Relay4,!digitalRead(Relay4));
delay(100);
break;
//if recieving a 52(ascii for 4) turn on Relay #4
case 53:
digitalWrite(Relay1, HIGH);
digitalWrite(Relay2, HIGH);
digitalWrite(Relay3, HIGH);
digitalWrite(Relay4, HIGH);
break;
//if recieving a 53(ascii for 5) turn on ALL Relays
case 54:
digitalWrite(Relay1, LOW);
digitalWrite(Relay2, LOW);
digitalWrite(Relay3, LOW);
digitalWrite(Relay4, LOW);
break;
//if recieving a 54(ascii for 6) turn OFF ALL Relays
}
}
//Notes : Remember to connect relay line 1, 2, 3 and 4 to PIN 2, 3, 4 & 5 of your Arduino board, otherwise it will not work. Thanks Guys.